<form action="{:url('Rbac/editUser')}" class="layui-form layui-form-pane" method="post" style="margin: 20px">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">账号</label>
            <div class="layui-input-inline">
                <input type="text" lay-verify="required" name="username" value="{$user.username}" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-inline">
                <input type="text" lay-verify="required" name="admin_info_name" value="{$user.admin_info_name}" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">身份</label>
        <div class="layui-input-inline">
            <select name="role_id" lay-verify="required">
                <option value=""></option>
                {volist name="role" id="r"}
                <option value="{$r.role_id}" {eq name="$r.role_id" value="$user.role_id"}selected{/eq} >{$r.role_name}</option>
                {/volist}
            </select>
        </div>
    </div>




    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">是否是门店</label>
            {if $user['is_store']==1}
            <span class="radio" val="1"><input type="radio" name="is_store" value="1"  title="是"  checked></span>
            <span class="radio" val="2"><input type="radio" name="is_store" value="2" title="否"></span>
            {else/}
            <span class="radio" val="1"><input type="radio" name="is_store" value="1"  title="是"  ></span>
            <span class="radio" val="2"><input type="radio" name="is_store" value="2" title="否" checked></span>
            {/if}
        </div>
    </div>
    {if $user['is_store']==1}
    <div class="layui-form-item store_type">
        <label class="layui-form-label">门店类型</label>
        <div class="layui-input-inline">
            <select name="store_type">
                <option value="1" {eq name="$user.store_type" value="1"}selected{/eq}>主店</option>
                <option value="2" {eq name="$user.store_type" value="2"}selected{/eq}>分店</option>
                <option value="3" {eq name="$user.store_type" value="3"}selected{/eq}>特殊分店</option>
            </select>
        </div>
    </div>
    {else/}
    <div class="layui-form-item store_type" style="display: none">
        <label class="layui-form-label">门店类型</label>
        <div class="layui-input-inline">
            <select name="store_type">
                <option value=""></option>
                <option value="1">主店</option>
                <option value="2">分店</option>
                <option value="3">特殊分店</option>
            </select>
        </div>
    </div>
    {/if}

    <div class="layui-form-item">
        <input type="hidden" name="admin_id" value="{$id}">
        <button class="layui-btn" lay-submit="" lay-filter="ajax">修改</button>
    </div>
</form>

<script>
    layui.use([ 'form'], function () {
        var form = layui.form;
        form.render();
    })
</script>

<script>
    $(".radio").click(function(){
        var val = $(this).attr("val");
        if(val==1){
            $(".store_type").css('display', 'block');
        } else {
            $(".store_type").css('display', 'none');
        }
    });
</script>